package map;

import java.util.HashSet;
import java.util.Set;

public class Leedcode771宝石与石头 {
    public int numJewelsInStones(String jewels, String stones) {
        Set set = new HashSet<Character>();
        for(int i = 0;i < jewels.length() ; i++){
            set.add(jewels.charAt(i));
        }
        int count = 0;
        for(int i = 0;i < stones.length(); i++){
            if (set.contains(stones.charAt(i))) {
                count++;
            }
        }
        return count;
    }
}
